package com.lanou3g.ptp.achievement.service;

import com.github.pagehelper.PageInfo;
import com.lanou3g.ptp.entity.Comment;
import com.lanou3g.ptp.entity.Diary;
import com.lanou3g.ptp.entity.Like;
import com.lanou3g.ptp.exception.PtpException;
import com.lanou3g.ptp.utils.PtpResult;
import com.lanou3g.ptp.vo.AlertBody;
import com.lanou3g.ptp.vo.DiaryCalendarResult;
import com.lanou3g.ptp.vo.DiaryDetails;
import com.lanou3g.ptp.vo.DiaryVO;

import java.util.Date;
import java.util.List;


public interface DiaryService {

    //查询所有
    PageInfo<Diary> findAllDiary(Integer page, Integer size);

    List<Diary> findAll1Diary();

    //模糊查询
    PageInfo<Diary> findByKeyword(Integer page, Integer size, String keyword);

    //通过ID查询
    Diary findDiaryById(Long id);

    //新增
    boolean insertDiary(Diary diary);

    //修改
    void updateDiary(Long id, Diary diary);

    //根据ID删除
    void deleteDiaryId(Long id);

    //删除多个
    void deleteDiaryIds(Long[] ids);

    //学生查询所有
    List<Diary> MyFindAll(Long id);

    //查询日志情况
    List<Diary> findDiarySituation(Date date, Long taskId);

    //查询指定时间内的日志
    Diary findByTime(Date date, Long taskId, Long studentId);

    PageInfo<Diary> findDiariesWithLikesAndCommentsByTaskId(Long taskId, Integer limit);

    DiaryDetails findDiaryDetailsByTeachlinkId(Long taskId) throws PtpException;

    boolean delete(Diary diary);

    boolean like(Like like);

    boolean unlike(Like like);

    boolean postComment(Comment comment);

    boolean deleteComment(Long commentId, Long studentId);

    List<DiaryVO> findByTaskAndStudent(Long taskId, Long studentId);

    /**
     * 更新日志的状态为已被推优
     *
     * @param diaryId
     */
    void excellentDiary(Long diaryId) throws PtpException;

    PageInfo<Diary> findDiariesWithLikesAndCommentsByTaskIds(Long[] taskIds, Integer page, Integer size);

    List<DiaryCalendarResult> findDiaryCalendar(Long taskId, Long studentId);

    int getTimesInARow(Long taskId, Long studentId);

    int getTimesPerWeek(Long taskId, Long studentId);

    int getTimesInTotal(Long taskId, Long studentId);

    boolean writeUpDiary(Diary diary);

    boolean alertDiary(AlertBody alert);
}
